Spot-On
spot-on-rosetta.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_rosetta_h_
29 #define _spoton_rosetta_h_
30 
31 #include <QPointer>
32 
33 #ifdef SPOTON_GPGME_ENABLED
34 extern "C"
35 {
36 #include <gpgme.h>
37 }
38 #endif
39 
40 #include "ui_spot-on-rosetta.h"
41 
42 class QKeyEvent;
43 class spoton;
45 
46 class spoton_rosetta: public QMainWindow
47 {
48  Q_OBJECT
49 
50  public:
51  enum DestinationTypes
52  {
53  GPG = 0,
54  ROSETTA,
55  ZZZ
56  };
57 
58  spoton_rosetta(void);
59  void setName(const QString &text);
60  void show(spoton *parent);
61 
62  private:
63  Ui_spoton_rosetta ui;
64  QPointer<spoton> m_parent;
65 #ifdef SPOTON_GPGME_ENABLED
66  QPointer<spoton_rosetta_gpg_import> m_gpgImport;
67 #endif
68  QByteArray copyMyRosettaPublicKey(void) const;
69  QByteArray gpgEncrypt(const QByteArray &receiver,
70  const QByteArray &sender) const;
71  QMap<QString, QByteArray> gpgEmailAddresses(void) const;
72 #ifdef SPOTON_GPGME_ENABLED
73  static QPointer<spoton_rosetta> s_rosetta;
74  static gpgme_error_t gpgPassphrase(void *hook,
75  const char *uid_hint,
76  const char *passphrase_info,
77  int prev_was_bad,
78  int fd);
79 #endif
80  void keyPressEvent(QKeyEvent *event);
81  void populateContacts(void);
82  void populateGPGEmailAddresses(void);
83  void resizeEvent(QResizeEvent *event);
84  void sortContacts(void);
85  void toDesktop(void) const;
86 
87  private slots:
88  void slotAddContact(void);
89  void slotClear(void);
90  void slotClearClipboardBuffer(void);
91  void slotClose(void);
92  void slotContactsChanged(int index);
93  void slotConvertDecrypt(void);
94  void slotConvertEncrypt(void);
95  void slotCopyDecrypted(void);
96  void slotCopyEncrypted(void);
97  void slotCopyMyGPGKeys(void);
98  void slotCopyMyRosettaPublicKeys(void);
99  void slotCopyOrPaste(void);
100  void slotDecryptClear(void);
101  void slotDecryptReset(void);
102  void slotDelete(void);
103  void slotImportGPGKeys(void);
104  void slotParticipantAdded(const QString &type);
105  void slotPopulateGPGEmailAddresses(void);
106  void slotRemoveGPGKeys(void);
107  void slotRename(void);
108  void slotSaveName(void);
109  void slotSetIcons(void);
110  void slotSplitterMoved(int pox, int index);
111 
112  signals:
113  void gpgKeysRemoved(void);
114  void participantAdded(const QString &type);
115  void participantDeleted(const QString &oid, const QString &type);
116  void participantNameChanged(const QByteArray &publicKeyHash,
117  const QString &name);
118 };
119 
120 #endif
spoton
Definition: spot-on.h:433
spoton_rosetta_gpg_import
Definition: spot-on-rosetta-gpg-import.h:36
spoton_rosetta
Definition: spot-on-rosetta.h:46